package org.alex.jdk8.lambda;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class EchoImpl {
	public static void main(String[] args) {
		File file = new File("E:/创建表空间.sql");
		StringBuilder sb = new StringBuilder();
		Echo<File, StringBuilder> echo = (f) -> {
			try {
				BufferedReader br = new BufferedReader(new FileReader(f));
				String line = null;
				while ((line = br.readLine()) != null) {
					sb.append(line);
				}
				br.close();
				return sb;
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return null;
		};
		System.out.println(echo.echo(file));
	}
}

@FunctionalInterface
interface Converter<F, T> {
	T convert(F from);
}
